package org.karelun.gef.parts;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.karelun.gef.model.ActorModel;
import org.karelun.gef.model.CombinationConnectionModel;
import org.karelun.gef.model.ImageModel;
import org.karelun.gef.model.RealizeConnectionModel;
import org.karelun.gef.model.AssociationConnectionModel;
import org.karelun.gef.model.AttributeModel;
import org.karelun.gef.model.ClassModel;
import org.karelun.gef.model.DependencyConnectionModel;
import org.karelun.gef.model.DiagramModel;
import org.karelun.gef.model.InterfaceModel;
import org.karelun.gef.model.MethodModel;
import org.karelun.gef.model.PackageModel;
import org.karelun.gef.model.GeueralizationConnectionModel;
import org.karelun.gef.model.RelationModel;
import org.karelun.gef.model.StateModel;
import org.karelun.gef.model.StateChoiceModel;
import org.karelun.gef.model.StateEndModel;
import org.karelun.gef.model.StateStartModel;
import org.karelun.gef.model.UserCaseModel;


public class PartFactory implements EditPartFactory {
	
    public EditPart createEditPart(EditPart context, Object model) {
        EditPart part = null;
        if (model instanceof DiagramModel)
            part = new DiagramPart();
        else if (model instanceof ClassModel)
            part = new ClassPart();
        else if (model instanceof AttributeModel)
            part = new AttributePart();    
        else if(model instanceof MethodModel)
        	part=new MethodPart();
        else if(model instanceof ImageModel)
        	part=new ImagePart();
        else if(model instanceof PackageModel)
        	part=new PackagePart();
        else if(model instanceof InterfaceModel)
        	part=new InterfacePart();
        else if(model instanceof RelationModel)
        	part=new RelationPart();
        
        else if(model instanceof StateModel)
        	part= new StatePart();
        else if(model instanceof StateStartModel)
        	part= new StateStarPart();
        else if(model instanceof StateEndModel)
        	part= new StateEndPart();
        else if(model instanceof StateChoiceModel)
        	part= new StateChoicePart();       
        
        else if (model instanceof CombinationConnectionModel)
        	 part = new CombinationConnectionEditPart();
        else if(model instanceof RealizeConnectionModel)
        	part=new RealizeConnectionEditPart();
        else if(model instanceof DependencyConnectionModel)
        	part=new DependencyConnectionEditPart();
        else if(model instanceof GeueralizationConnectionModel)
        	part=new GeueralizationConnectionEditPart();  
        else if(model instanceof AssociationConnectionModel)
        	part=new AssociationConnectionEditPart();
        
        else if (model instanceof UserCaseModel)
            part = new UserCasePart();   
        else if (model instanceof ActorModel)
    	    part = new ActorPart();   	   
             
        part.setModel(model);
        return part;
    }
}